﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace CivilleWP7.Views.Pages
{
    public partial class LoginPage : PhoneApplicationPage
    {
        private CookieContainer cookieContainer;

        public LoginPage()
        {
            InitializeComponent();
        }

        private void LogInButton_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/Views/Pages/PanoramaPage.xaml", UriKind.Relative));
            //AuthenticationServiceReference.AuthenticationServiceClient authService =
            //    new AuthenticationServiceReference.AuthenticationServiceClient();
            //cookieContainer = new CookieContainer();
            //authService.CookieContainer = cookieContainer;
            //authService. LoginCompleted +=
            //  new EventHandler<AuthenticationServiceReference.LoginCompletedEventArgs>(
            //AuthService_LoginCompleted);
            //authService.LoginAsync(UserTextBox.Text, PasswordTextBox.Text, "", true);
        }

        //void AuthService_LoginCompleted(object sender, AuthenticationServiceReference.LoginCompletedEventArgs e)
        //{
        //    if (e.Error != null)
        //    {
        //        MessageBox.Show("Login failed, you Jackwagon.");
        //    }
        //    else
        //    {
        //        WelcomeServiceReference.WelcomeServiceClient welcomeService =
        //         new WelcomeServiceReference.WelcomeServiceClient();
        //        welcomeService.CookieContainer = cookieContainer;
        //        welcomeService.WelcomeUserCompleted +=
        //        new EventHandler<WelcomeServiceReference.WelcomeUserCompletedEventArgs>(WelcomeService_WelcomeUserCompleted);
        //        welcomeService.WelcomeUserAsync();
        //    }
        //}

        //void WelcomeService_WelcomeUserCompleted(object sender, WelcomeServiceReference.WelcomeUserCompletedEventArgs e)
        //{
        //    MessageBox.Show("You're logged in: " + e.Result);
        //}

        private void ForgotPasswordTextBlock_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {

        }
    }
}
